/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
 */
package org.sbbs.base.demo.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.ManyToMany;
import jakarta.persistence.Table;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.Comment;
import org.hibernate.search.mapper.pojo.mapping.definition.annotation.*;
import org.sbbs.base.jpa.entity.BaseEntity;

import java.util.HashSet;
import java.util.Set;

/**
 *
 * @author jenkins
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "t_book")
@Comment("图书样例表")
// This entity is mapped to an index
@Indexed
public class Book  extends BaseEntity {

    // The entity ID is the document ID
//    @Id
//    @GeneratedValue
//    private Integer id;

    // This property is mapped to a document field
    @FullTextField 
    private String title;

    @KeywordField 
    private String isbn;

    @GenericField 
    private int pageCount;

    @ManyToMany
    @IndexedEmbedded 
    private Set<Author> authors = new HashSet<>();
    
}
